package stringdemo;

/**
 * Created with IntelliJ IDEA.
 * Description:
 * User: 苏李涛
 * Date: 2024-07-05
 * Time: 21:28
 */
public class StringTest2 {
    public static void main(String[] args) {
        String s1 = new String("bte");
        String s2 = new String("btE");

        String s3 = s1;//相当于在栈区，把s1的引用，给s3(也相当于覆盖)
        System.out.println(s2 == s1);//false
        System.out.println(s3 == s1);//ture，这里是引用比较
        System.out.println(s1.equals(s3));//true，String子类，重写了object父类，的equals方法

    }
}
